public class Test {
    public static void main(String[] args) {
        Person peo=new Person();

        peo.setName("zhangsan");
        String s=peo.getName();
        System.out.println("返回值name:"+s);

        peo.show();
    }
}
class Person{
    private String name;   //被private封装，只能在当前类中更改

    public int age;        //要访问private修饰的成员变量，可以再用一个public方法，从而可以外部访问

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void show(){
        System.out.println("name:"+name+" age:"+age);
    }
}